package service.impl;

import dao.SearchDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.SearchService;
import util.MessageUtil;
import util.ReturnResultUtil;
import view.QueryView;

import java.time.LocalDate;

/**
 * Created by gable on 2018/5/23.
 */
@Service
public class SearchServiceImpl implements SearchService {

    @Autowired
    SearchDao searchDao;

    @Override
    public ReturnResultUtil queryLatestDate() {
        QueryView queryView = searchDao.queryLatestDate();
        if(queryView == null){
            queryView = new QueryView();
            queryView.setYear(LocalDate.now().getYear());
            queryView.setMonth(LocalDate.now().getMonthValue());
        }
        return new ReturnResultUtil(1, MessageUtil.SUCCESS,queryView);
    }
}
